package cn.org.itool.ws.framework.constent;


import cn.hutool.core.util.ArrayUtil;

public enum FtMessageTypeEnum {

    CLIENT_REQ(1, "客户端请求"),
    CLIENT_PUSH(2, "客户端推送(无返回)"),
    SERVER_RESP(3, "服务端响应"),
    SERVER_PUSH(4, "服务端推送(无返回)");
    private final int code;
    private final String desc;

    FtMessageTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static FtMessageTypeEnum valueOf(int code) {
        return ArrayUtil.firstMatch(msgType ->  code == msgType.getCode(), FtMessageTypeEnum.values());
    }
}
